home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 8991 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.8 KB  |  45 lines

  1. Newsgroups: comp.lang.c
  2. Path: bcc.ac.uk!slidel
  3. From: slidel@bsm.bioc.ucl.ac.uk (Timothy Slidel)
  4. Subject: Re: do || die;
  5. Message-ID: <1996Mar7.204045.58337@ucl.ac.uk>
  6. Date: Thu, 7 Mar 1996 20:40:45 GMT
  7. References: <1996Mar7.052636.59812@ucl.ac.uk> <4hmaf2INNqir@keats.ugrad.cs.ubc.ca>
  8. Organization: University College London
  9. X-Newsreader: TIN [version 1.2 PL2]
  10.  
  11. Kazimir Kylheku (c2a192@ugrad.cs.ubc.ca) wrote:
  12. : I did. I found out from the C grammar listed in the K&R that a the
  13. : ``statement'' syntactic unit generates a ``logical-AND-expression ; ''
  14. : sentential form quite happily. :)
  15.  
  16. Ok - I saw this bit, but there are lots of things in C that are
  17. syntactically correct but look awful..
  18.  
  19. : >issues a warning about an unused value...
  20. : ...which is somewhat of an indicator that all may not be well, stylistically.
  21.  
  22. One could always stick a (void) cast before such a statement to discard the
  23. value, as should/could be done with unused function return values - just to
  24. be pedantic...
  25.  
  26. : It might seem confusing at first to someone not accustomed to dealing with
  27. : Bourne shell scripts or Perl.
  28.  
  29. Yes, I use Perl quite a bit - which is where I picked up this habit, but I
  30. hadn't thought of using it in C because you can't do things like:
  31.  
  32. condition && break;
  33.  
  34. etc. like you can (I think usefully) in Perl. Which is one reason why I am
  35. somewhat reluctant to use it. Of course, the short-circuitness of the logical
  36. operators comes into its own inside if statements - as in the old getchar K&R
  37. example (p. 41), so why shouldn't we use this feature 'on its own'?
  38.  
  39. --
  40. Tim Slidel,                                   Email: t.slidel@biochem.ucl.ac.uk
  41. BSM Unit, Biochemistry and Molecular Biology, Tel: +44 171419 3896
  42. University College, Gower Street,             Fax: +44 171380 7193
  43. London WC1E 6BT, United Kingdom.
  44.  
  45.